package com.beyondbit.demo.service.impl;

import com.beyondbit.demo.dao.CommonAttachmentMapper;
import com.beyondbit.demo.entity.CommonAttachment;
import com.beyondbit.demo.service.CommonAttachmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CommonAttachmentServiceImpl implements CommonAttachmentService {
    @Autowired
    private CommonAttachmentMapper commonAttachmentMapper;

    @Override
    public int insert(CommonAttachment attachment) {
        return commonAttachmentMapper.insert(attachment);
    }

    @Override
    public int deleteById(String attachmentId) {
        return commonAttachmentMapper.deleteById(attachmentId);
    }

    @Override
    public CommonAttachment getById(String attachmentId) {
        return commonAttachmentMapper.getById(attachmentId);
    }


    /**
     * 查询附件
     *
     * @param query
     * @return
     */
    @Override
    public List<CommonAttachment> query(CommonAttachment query) {
        return commonAttachmentMapper.query(query);
    }

    @Override
    public CommonAttachment queryMainAttachment(String commonID) {
        return commonAttachmentMapper.queryMainAttachment(commonID);
    }
}
